package com.zcf.controller;

import com.zcf.pojo.Result;
import com.zcf.service.UploadService;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;

/**
 * @author zcf
 */
@RestController
@RequestMapping("/upload")
public class UploadController {

    @Resource
    @Qualifier("uploadServiceImpl")
    private UploadService uploadService;

    @PostMapping
    public Result<String> upload(MultipartFile file){
      String url=  uploadService.upload(file);
        return Result.success(url);
    }
}
